<?php
	//require config.php;
	
	//$connect = mysql_connect($db['host'], $db['user'], $db['pass']);
	//$connect = mysql_connect($db_hosf, $db_user, $db_pw);
	
	$connect = mysql_connect("localhost", "root", "123");
	if (!$connect){
		die('Kunne ikke koble til databasen: ' . mysql_error());
	}
	else
		echo "Koblet til mysql databsen";
	
	function sjekk_ip_serie() {
		if ($_GET["ip1"] && $_GET["ip2"] && $_GET["ip3"] && $_GET["ip4"])
			return true;
		else
			return false;
	}
	
	
	
	if ($_GET["vlan_id"]) {
		mysql_select_db("hisfipam", $connect);
		echo "<br></br>";
		echo $_GET["vlan_id"];
		echo "<br></br>";
		echo $_GET["vlan_beskrivelse"];
		
		$sql="INSERT INTO vlan (id, beskrivelse) 
				VALUES('$_GET[vlan_id]','$_GET[vlan_beskrivelse]')";

		if (!mysql_query($sql,$connect)) {
			die('Error: ' . mysql_error());	
		}
		echo "Lagt til vlan";
		
		mysql_close($connnect);
		
	}
	
	
	if (sjekk_ip_serie()) {
		//echo $_GET["ip1"]+.+$_GET["ip2"]+.+$_GET["ip3"]+.+$_GET["ip4"];
		echo $_GET["ip1"];
		echo ".";
		echo $_GET["ip2"];
		echo ".";
		echo $_GET["ip3"];
		echo ".";
		echo $_GET["ip4"];
		
	}
	
	
	if ($_GET["tag"]) {
		echo $_GET["tag"];
	}
	
	
?>
<head>
	<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
	<form action="import.php" method="get">
		<div id="vlan_sok">
			Vlan id: 
			<input type="text" name="vlan_id">
			Vlan beskrivelse:
			<input type="text" name="vlan_beskrivelse">
			<input type="submit" value="Legg til">
		</div>
	</form>
	<form action="import.php" method="get">
		<div id="ip_serie_add">
			IP serie:
			<input class="ip_serie_boks" type="text" name="ip1">
			<input class="ip_serie_boks" type="text" name="ip2">
			<input class="ip_serie_boks" type="text" name="ip3">
			<input class="ip_serie_boks" type="text" name="ip4">
			<input type="submit" value="Legg til">
		</div>
	</form>
	<form action="import.php" method="get">
		<div id="tag_sok">
			Tag
			<input type="text" name="tag">
			<input type="submit" value="Legg til">
		</div>
	</form>
